﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using DICE_GS;

[System.Serializable]
public class StartTilePos
{
	public Vector3 startPos;
	public Vector3 goalPos;
	public element elementType;

}

public class StartTilePosInfo : MonoBehaviour {

	public List<StartTilePos> infoList = new List<StartTilePos>();

	public Vector3 GetPos(bool isStart, element elementType, Vector3 originalPos)
	{
		bool bFound = false;
		foreach( StartTilePos stpos in infoList)
		{
			if(stpos.elementType == elementType)
			{
				bFound = true;
				break;
			}
		}

		if(!bFound)
			elementType = element.sky;

		foreach( StartTilePos stpos in infoList)
		{
			if(stpos.elementType == elementType)
			{
				if(isStart)
				{
					if( stpos.startPos != Vector3.zero)
						return new Vector3(stpos.startPos.x, stpos.startPos.y, originalPos.z);
					else
						return originalPos;
				}
				else
				{
					if(stpos.goalPos != Vector3.zero)
						return new Vector3(stpos.goalPos.x, stpos.goalPos.y, originalPos.z);
					else
						return originalPos;
				}
			}
		}
		return originalPos;
	}
}
